class Solution {
public:
    int numRabbits(vector<int>& answers) {
        if(!answers.size())return 0;
        int hash_num[1000];
        memset(hash_num, 0, sizeof(hash_num));
        for(int i = 0; i < answers.size(); i++){
            hash_num[answers[i]]++;
        }
        int ans = 0;
        for(int i = 0; i < 1000; i++){
            ans += ceil(double(hash_num[i]) / double(i + 1)) * (i + 1);  
        }
        return ans;
    }
};

//2021.4.4 
